package cn.tedu.tourism.travelAgency.controller;

import cn.tedu.tourism.base.response.JsonResult;
import cn.tedu.tourism.travelAgency.pojo.dto.TravelAgencyQuery;
import cn.tedu.tourism.travelAgency.pojo.dto.TravelDetailQuery;
import cn.tedu.tourism.travelAgency.pojo.entity.TravelDetail;
import cn.tedu.tourism.travelAgency.pojo.vo.TravelAgencyVO;
import cn.tedu.tourism.travelAgency.pojo.vo.TravelDetailVO;
import cn.tedu.tourism.travelAgency.pojo.vo.TravelPackagesVO;
import cn.tedu.tourism.travelAgency.service.TravelAgencyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.spring.web.json.Json;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/travelagent")
@Api(tags = "旅行社接口")
public class TravelAgencyController {
   @Autowired
   private TravelAgencyService travelAgencyService;

   @ApiOperation(value="查询旅行团套餐功能实现")
    @GetMapping("select")
    public JsonResult selectTravelAgent(TravelAgencyQuery travelAgencyQuery) {
        List<TravelPackagesVO> list = travelAgencyService.selectTravelAgent(travelAgencyQuery);
        return JsonResult.ok(list);
    }

    @PostMapping("/selectcity")
    public JsonResult selectCity(){
       List<String> city = travelAgencyService.selectCity();
       return JsonResult.ok(city);
    }

    @GetMapping("/searchTravelDetail")
    public JsonResult searchTravelDetail(TravelDetailQuery travelDetailQuery) {
        log.debug("旅行详情为：travelDetail="+travelDetailQuery);
        List<TravelDetailVO> details = travelAgencyService.searchTravelDetailCity(travelDetailQuery);
        return JsonResult.ok(details);
    }

    @GetMapping("/searchTravelDetailCity")
    public JsonResult searchTravelDetailCity(TravelDetailQuery travelDetailQuery) {
       log.debug("旅行详情为：travelDetail="+travelDetailQuery);
        List<TravelDetailVO> details = travelAgencyService.searchTravelDetailCity(travelDetailQuery);
        return JsonResult.ok(details);
    }

    @GetMapping("/searchTravelDetailProvince")
    public JsonResult searchTravelDetailProvince(TravelDetailQuery travelDetailQuery) {
        log.debug("旅行详情为：travelDetail="+travelDetailQuery);
        List<TravelDetailVO> details = travelAgencyService.searchTravelDetailProvince(travelDetailQuery);
        return JsonResult.ok(details);
    }
    @GetMapping("/city/select")
    public JsonResult selectMarket() {
        List<TravelDetailVO> markets = travelAgencyService.selectMarket();
        return JsonResult.ok(markets);

    }
    @GetMapping("/province/select")
    public JsonResult selectProvince() {
        List<TravelDetailVO> provinces = travelAgencyService.selectProvince();
        return JsonResult.ok(provinces);
    }
}
